#include "GreyscaleCodeReader.h"
#include <newcode/detector/DetectorGC.h>

namespace newcode {
using namespace newcode::detector;
using namespace std;

GreyscaleCodeReader::GreyscaleCodeReader():decoder() {}

Ref<Result> GreyscaleCodeReader::decode(Ref<ByteMatrix> image)
{
    Detector detector(image);
    Ref<GrayscaleDetectorResult> detectorResult = detector.detect();
    Ref<DecoderResult> decoderResult =
        decoder.decode(detectorResult->getBytes());
    Ref<Result> result(new Result(decoderResult->getText(),
    decoderResult->getRawBytes(), detectorResult->getPoints(),
        BarcodeFormat_GREYSCALE));
    return result;
}

}
